<?php

class Application_Form_CursoTarefa extends Zend_Form
{

    public function init()
    {
        $this->clearDecorators();
        
        $this->setName('tarefa');

        $id = new Zend_Form_Element_Hidden('id');
        $id->setDecorators(array(
            array('ViewHelper')
        ));

        $status_id = new Zend_Form_Element_Select('status_id');
        $status_id->setLabel('Status');
        $status = new Status();
        $rowSet = $status->fetchAll(null);
        foreach($rowSet as $current)
        {
            $status_id->addMultiOption($current->id,$current->status);
        }
        $status_id->setAttrib('onchange', 'this.form.submit()')
            ->setDecorators(array(
            array('ViewHelper'),
            array('Label',array('tag'=>null)),
            array('HtmlTag',array('tag'=>'span'))
            ));
        $status_id->getDecorator('Label')->setOption('tag', null);

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton')
               ->setLabel('Gravar');
        $submit->setDecorators(array(
            array('ViewHelper'),
            array('HtmlTag',array('tag'=>'span','class'=>'submit'))
            ));
        
        $this->setDecorators(array(
           'FormElements',
            array('HtmlTag',array('tag'=>'div','class'=>'div_form')),
            'Form'
            ));

        $this->addElements(array($id, $status_id));
    }
}

